package com.tengju.payment.domain.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;


/**
 * 渠道类型枚举
 */
@AllArgsConstructor
public enum ChannelType {

    CITIC_BANK(10, "中信银行"),

    UNION_PAY(20, "中国银联"),

    PING_AN_DEPOSITORY(30, "平安见证宝");

    private int val;
    private String desc;

    @JsonValue
    public int getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static ChannelType fromVal(int val) {
        for (ChannelType data : values()) {
            if (data.val == val) {
                return data;
            }
        }
        return null;
    }
}
